class Test(object):
    def __setattr__(self, key, value):
        print("设置属性，会调用此方法")
        super().__setattr__(key,value)

    def __delattr__(self, item):
        print("属性被删除了")
        super().__delattr__(item)
    #
    # def __getattribute__(self, item):
    #     print("查找属性时，首先会进入该方法中")
    #     return "001"
    #
    # def __getattr__(self, item):
    #     print("没有找到属性时，触发AttributeError异常时会调用此方法")


t=Test()
t.attr=1001
print(t.__dict__)
print(t.attr)
del t.attr
print(t.attr)
